import { createRouter, createWebHashHistory } from "vue-router";

const router = createRouter({
  history: createWebHashHistory(), // hash模式：createWebHashHistory，history模式：createWebHistory
  routes: [
    {
      path: '/',
      redirect:'home',
      component: () => import('@/views/layout'),
      children: [
        { path: '/home', name: 'home', component: () => import('@/views/Home.vue') }, // 首页
        { path: '/list', name: 'list', component: () => import('@/views/list/List.vue') }, // 点单
        { path: '/shop', name: 'shop', component: () => import('@/views/Shop.vue') }, // 商城
        { path: "/order", name: "order", component: () => import('@/views/order/Order.vue') },// 订单
        { path: "/user", name: "user", component: () => import('@/views/user/User.vue'), },// 我的
      ]
    },
    { path: "/myCard", name: "myCard", component: () => import('@/views/user/myCard.vue'), },// 我的卡
    { path: "/userInfo", name: "userInfo", component: () => import('@/views/user/userInfo.vue'), },// 我的信息
    { path: "/recharge", name: "recharge", component: () => import('@/views/user/recharge.vue'), },// 充值
  ],
});

export default router;
